package com.dragon.repository.domain.dto;

import com.dragon.repository.entity.ModRole;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.dragon.common.util.BeanUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.Date;


/**
 * @author sy
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ModRoleDTO {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "角色模块id")
    private Integer id;

    @ApiModelProperty(value = "角色id")
    private Integer roleId;

    @ApiModelProperty(value = "模块id")
    private Integer modId;


    public ModRoleDTO() {}

    public ModRoleDTO(ModRole entity) {
        BeanUtils.copyProperties(entity,this);
    }

    public static ModRoleDTO convert(ModRole entity) {
        return new ModRoleDTO(entity);
    }

    public static List<ModRoleDTO> convertList(List<ModRole> list) {
        List<ModRoleDTO> resultList = new ArrayList<>();
        for (ModRole entity : list) {
            resultList.add(new ModRoleDTO(entity));
        }
        return resultList;
    }}
